package cn.dw.web.action;

import com.opensymphony.xwork2.ActionSupport;

import cn.dw.utils.AdvancedUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;

public class OAuthAction
  extends ActionSupport
{
  private static final long serialVersionUID = -4023139237519988372L;
  
  @SuppressWarnings("unused")
public String getCode() throws Exception
  {
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();
    
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
    

    String code = request.getParameter("code");
    String state = request.getParameter("state");
    

    System.out.println("code===========" + code);
    System.out.println("state=======" + state);
    if (!"authdeny".equals(code)) {
      String str1 = AdvancedUtil.getOauth2AccessToken("wx3542023ee690ee77", "24f082810558ac098fe21c2df1663904", code);
    }
    return null;
  }
}
